package 杨佳佳.作业;

public class SumUtils {
        public int numInt1, numInt2;
        public double numDouble1, numDouble2;
        public String str1, str2;

        public void sumUtils(int numInt1, int numInt2) {
            this.numInt1 = numInt1;
            this.numInt2 = numInt2;
            System.out.println("整数相加：" + (numInt1 + numInt2));
        }

        public void sumUtils(double numDouble1, double numDouble2) {
            this.numDouble1 = numDouble1;
            this.numDouble2 = numDouble2;
            System.out.println("小数相加：" + (numDouble1 + numDouble2));
        }

        public void sumUtils(String str1, String str2) {
            this.str1 = str1;
            this.str2 = str2;
            System.out.println("两个字符串相加：" + (str1 + str2));
        }

        public void sumUtils(int numInt1) {
            int result = 0;
            for (int i = 1; i < numInt1 + 1; i++) {
                result += i;
            }
            System.out.println("1到指定整数的和：" + result);
        }


    }

